<!-- InputNumber组件 -->
<template>
  <div>
    <input
      type="text"
      @compositionstart="handleComposition"
      @compositionupdate="handleComposition"
      @compositionend="handleComposition"
      @input="handleInput"
    />
  </div>
</template>

<script>
export default {
  name: 'InputNumber',

  components: {},

  props: {},

  data() {
    return {
      isOnComposition: false,
    }
  },

  computed: {},

  watch: {},

  created() {},

  mounted() {},

  methods: {
    handleComposition(event) {
      if (event.type === 'compositionstart') {
        this.isOnComposition = true
      }
      if (event.type === 'compositionend') {
        this.isOnComposition = false
        // this.handleInput(event);
      }
    },
    handleInput(e) {
      if (this.isOnComposition) e.preventDefault()
    },
  },
}
</script>

<style lang='less' scoped>
</style>
